package com.bookcode.service;


import com.bookcode.dao.CourseRepository;
import com.bookcode.entity.Course;
import com.bookcode.entity.CourseStudent;
import com.bookcode.entity.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class CourseService {

    @Autowired
    CourseRepository courseRepository;

    public Course findCourseById(Long id){
        return courseRepository.findById(id).get();
    }

    public void save(Course course){
        courseRepository.save(course);
    }

    public List<Course> findAll(){
        return courseRepository.findAll();
    }

}
